home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / research / examples / object / rot_text.pro < prev    next >
Text File  |  1997-07-08  |  2KB  |  72 lines

  1. ;-------------------------------------------------------------
  2. ; This procedure file defines the procedure rot_text, which is
  3. ; used as an example in Chapter 8 of _Objects and Object Graphics_.
  4. ;-------------------------------------------------------------
  5.  
  6. PRO rot_text
  7.  
  8. ; Create Window, View, Model, Text, and Font objects.
  9.  
  10. mywindow = OBJ_NEW('IDLgrWindow')
  11. myfont1 = OBJ_NEW('IDLgrFont', 'times', SIZE=14)
  12. myfont2 = OBJ_NEW('IDLgrFont', 'courier', SIZE=20)
  13. myview = OBJ_NEW('IDLgrView', VIEWPLANE_RECT=[0,0,10,10], COLOR=[255,255,255])
  14. mymodel = OBJ_NEW('IDLgrModel')
  15. mytext = OBJ_NEW('IDLgrText', 'Text String', LOCATION=[4,4], COLOR=[0,0,0])
  16.  
  17. ; Add the model object to the view object, and the text object
  18. ; to the model object. Set the projection and clipping planes.
  19.  
  20. myview -> Add, mymodel
  21. mymodel -> Add, mytext
  22. myview -> SetProperty, PROJECTION=2, EYE=50, ZCLIP=[5,-5]
  23.  
  24. ; Rotate text around Z axis by adjusting the baseline.
  25.  
  26. FOR i=-5,0 DO BEGIN
  27.   mytext->SetProperty, BASELINE=[1,0,i]
  28.   mywindow->Draw, myview
  29.   WAIT, 0.1
  30. ENDFOR
  31.  
  32. ; Rotate text around Y axis by adjusting the baseline.
  33.  
  34. FOR i=0,5 DO BEGIN
  35.   mytext->SetProperty, BASELINE=[1,i,0]
  36.   mywindow->Draw, myview
  37.   WAIT, 0.1
  38. ENDFOR
  39.  
  40. ; Text is vertical
  41.  
  42. mytext->SetProperty, BASELINE=[0,1,0], UPDIR=[-1,0,0]
  43. mywindow->Draw, myview
  44. WAIT, 1
  45.  
  46. ; Text is horizontal, set font, change color.
  47.  
  48. mytext -> SetProperty, FONT=myfont1, BASELINE=[1,0,0], $
  49.           UPDIR=[0,1,0], COLOR=[200,100,0]
  50. mywindow->Draw, myview
  51. WAIT, 1
  52.  
  53. ; Text is horizontal, set font, change color.
  54.  
  55. mytext -> SetProperty, FONT=myfont2, COLOR=[255,0,0], $
  56.           LOCATION=[1,4]
  57. mywindow->Draw, myview
  58.  
  59. ; Prompt to destroy objects.
  60.  
  61. var=''
  62. READ, var, PROMPT='press Return to destroy the window'
  63.  
  64. ; Destroy objects.
  65.  
  66. OBJ_DESTROY, mywindow
  67. OBJ_DESTROY, myview
  68. OBJ_DESTROY, myfont1
  69. OBJ_DESTROY, myfont2
  70.  
  71. END
  72.